package com.kc.gb.feign.ptl.support.dtos;

import com.kc.gb.feign.ptl.support.enums.PtlLightColor;
import com.kc.gb.feign.ptl.support.enums.PtlLightOnOff;
import com.kc.gb.feign.ptl.support.enums.PtlCommandType;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class LightCommand extends AbstractPtlCommand {
    PtlLightOnOff lightStatus;
    PtlLightColor lightColor;
    int interval;

    public LightCommand(int lightNo) {
        this.lightNo = lightNo;
        this.lightStatus = PtlLightOnOff.LIGHT_OFF;
        this.lightColor = PtlLightColor.RED;
        this.interval = 0;
    }

    public LightCommand(int lightNo, PtlLightOnOff lightStatus, PtlLightColor lightColor, int interval) {
        this.lightNo = lightNo;
        this.lightStatus = lightStatus;
        this.lightColor = lightColor;
        this.interval = interval;
    }

    public LightCommand turnOn(){
        this.lightStatus = PtlLightOnOff.LIGHT_ON;
        return this;
    }

    public LightCommand turnOff(){
        this.lightStatus = PtlLightOnOff.LIGHT_OFF;
        return this;
    }

    public LightCommand color(PtlLightColor color){
        this.lightColor = color;
        return this;
    }

    public LightCommand interval(int interval){
        this.interval = interval;
        return this;
    }

    @Override
    public PtlCommandType getCommandType() {
        return PtlCommandType.LIGHT;
    }
}
